package com.atguigu.yygh.controller;

import com.atguigu.yygh.common.result.Result;
import com.atguigu.yygh.model.hosp.Schedule;
import com.atguigu.yygh.service.IScheduleService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author kabuda
 * @create 2023-03-02 20:14
 */
@RestController
@RequestMapping("/admin/hosp/schedule")
public class ScheduleController {
    @Resource
    private IScheduleService scheduleService;

    @GetMapping("/getRuleSchedule/{page}/{limit}/{hospcode}/{depcode}")
    public Result getRuleSchedule(@PathVariable("page") Integer page, @PathVariable("limit") Integer limit, @PathVariable("hospcode") String hospcode, @PathVariable("depcode")String depcode){
       Map<String,Object> map=scheduleService.getScheduleRule(page,limit,hospcode,depcode);
       return Result.ok(map);
    }

    @GetMapping("/getScheduleDetail/{hospcode}/{depcode}/{workDate}")
    public Result getScheduleDetail(@PathVariable("hospcode")String hospcode,@PathVariable("depcode")String depcode,@PathVariable("workDate")String workDate){
        List<Schedule> list=scheduleService.getScheduleDetail(hospcode,depcode,workDate);
        return Result.ok(list);
    }


}
